define(function(require) {

    require('../../../c/base/index');

    require('../../../c/nav/index');


    var shopTable;
    var firstTime = true;
    var totalCount = 0;

    var Config = {
        init: function() {
            //初始化菜单选中效果
            $(".fa-circle-o").each(function() {
                if ($(this).parents("a").text() == "店铺财务复审") {
                    $(this).parents("a").parents("li").addClass("active");
                }
            });
            this.initShopTable();
            this.initValidator();
            this.initDatas();
            this.initDatetimepicker();
            this.bindXiaoerInfo();
            this.bindEvent();
            this.initCity();
            this.initSearch();
            //默认取urlParam参数
            var shopId = CRM.getUrlParam("id");
            if (shopId) {
                $("#shop_id").val(shopId);
                this.doSearch();
            }
        },
        /**
         * 城市初始化
         */
        initCity: function() {
            CRM.request({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/city/queryOpenCity'),
                "dataType": "json",
                contentType: "application/json",
                data: JSON.stringify({}),
                "success": function(req) {
                    if (req.status) {
                        $.each(req.entry, function(index, item) {
                            $("#city_id").append("<option value='" + item.cityCode + "'>" + item.city + "</option>");
                        });
                    } else {
                        CRM.showDialog(req.message);
                    }
                }
            });
        },
        /**
         * 执行初始化查询.
         */
        initSearch: function() {
            $('#shop_table').DataTable().ajax.reload();
        },
        /**
         * 执行查询操作.
         */
        doSearch: function() {
            $("#J_Search_checkBank").data('bootstrapValidator').validate();
            if ($("#J_Search_checkBank").data('bootstrapValidator').isValid()) {
                $('#shop_table').DataTable().ajax.reload();
            }
        },
        /**
         * 初始化店铺的列表
         */
        initShopTable: function() {
            var self = this;
            shopTable = $("#shop_table").dataTable({
                "oLanguage": CRM.pageConfig,
                "sScrollX": "100%", //表格的宽度
                "sScrollXInner": "100%", //表格的内容宽度
                "bScrollCollapse": true, //当显示的数据不足以支撑表格的默认的高度时，依然显示纵向的滚动条。(默认是false)
                "bPaginate": true, //是否显示分页
                "bLengthChange": true, //每页显示的记录数
                "bFilter": false, //搜索栏
                "bSort": false, //是否支持排序功能
                "bInfo": true, //显示表格信息
                "bAutoWidth": false, //自适应宽度
                "bServerSide": true, //开启服务端处理
                "sAjaxSource": CRM.getOuterUrl('/shop/shop/selectFinanceShopList'),
                "fnInitComplete": function() {
                    this.fnAdjustColumnSizing(true);
                },
                "fnServerData": function(sSource, aoData, fnCallback) {
                    if (firstTime) {
                        firstTime = false;
                        return;
                    }
                    var _url = CRM.getOuterUrl('/shop/shop/selectFinanceShopList');
                    var _data = {};
                    _data.pageBegin = aoData[3].value / aoData[4].value + 1;
                    _data.pageSize = aoData[4].value;
                    if ($("#shop_id").val()) { //通过ID查询
                        _data.shopId = $("#shop_id").val();
                    } else if ($('#city_id option:selected').val()) {
                        _data.cityCode = $('#city_id option:selected').val();
                    }
                    CRM.request({
                        "type": 'GET',
                        "url": sSource,
                        "dataType": "json",
                        contentType: "application/x-www-form-urlencoded",
                        xhrFields: {
                            withCredentials: true
                        },
                        "data": _data,
                        contentType: "application/json",
                        "success": function(req) {
                            if (req.status) {
                                var resultData = CRM.getDataTabelDtaObject();
                                if (req.entry) {
                                    resultData.iTotalDisplayRecords = req.entry.length;
                                    resultData.iTotalRecords = totalCount;
                                    $.each(req.entry, function(key, entry) {
                                        resultData.aaData.push([
                                            entry.id,
                                            CRM.htmlEncode(entry.shopName),
                                            CRM.htmlEncode(entry.city),
                                            CRM.htmlEncode(entry.shopFranchiseDesc),
                                            CRM.htmlEncode(entry.updateShopFranchiseDesc),
                                            CRM.htmlEncode(entry.statusDesc),
                                            CRM.htmlEncode(entry.typeDesc),
                                            entry.isBalance,
                                            CRM.htmlEncode(entry.tagsDesc),
                                            entry
                                        ]);
                                    });
                                } else {
                                    CRM.showDialog(req.message);
                                }
                                fnCallback(resultData);
                            } else {
                                CRM.showDialog(req.message);
                            }
                        }
                    });
                },
                "aaSorting": [
                    [1, "asc"]
                ], //给列表排序 ，第一个参数表示数组 (由0开始)。1 表示Browser列。第二个参数为 desc或是asc
                "aoColumns": [{
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": true,
                        "mRender": function(data, type, row) {
                            var html = "未知";
                            if (data == "1") {
                                html = "结算";
                            } else {
                                html = "不结算";
                            }

                            return html;
                        }
                    }, {
                        "bSortable": true
                    }, {
                        "bSortable": false,
                        "mRender": function(data) {
                            var id = data.id,
                                type = data.type;
                            var itemUrl = self.getItemUrl(id);
                            /*var html = '<div class="dropdown">';
                            html += '<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu_' + id + '" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">';
                            html += '更多操作<span class="caret"></span>';
                            html += '</button>';
                            html += '<ul class="dropdown-menu" aria-labelledby="dropdownMenu_' + id + '">';
                            html += "<li><a href='javascript:modifyShop(\"" + id + "\")'>信息审核</a></li>";
                            html += '</ul></div>';*/
                            var html = '<button onclick=modifyShop("' + id + '") class="btn btn-default">审核</button>';
                            return html;
                        }
                    }

                ], //列设置，表有几列，数组就有几项
                "bStateSave": true, //保存状态到cookie *************** 很重要 ， 当搜索的时候页面一刷新会导致搜索的消失。使用这个属性就可避免了
                "sPaginationType": "full_numbers" //分页，一共两种样式，full_numbers和two_button(默认)

            });
        },
        /**
         * 根据店铺名查询店铺数量
         */
        queryShopByNameCount: function() {
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/shop/queryShopByNameCount'),
                "dataType": "json",
                async: false, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({
                    "shopName": $("#shop_name").val(),
                    "operator": $.cookie('_uk')
                }),
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode && req.status) {
                        totalCount = req.entry;
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("根据店铺名查询店铺数量,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 表单验证初始化
         */
        initValidator: function() {
            $('#J_Search_checkBank').bootstrapValidator({
                message: '输入错误',
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    shop_id: {
                        message: 'error',
                        validators: {
                            regexp: {
                                regexp: /^[0-9]+$/,
                                message: '请输入数字'
                            }
                        }
                    },
                }
            });
        },
        /**
         * 根据用户ID获取用户信息
         * @param usserId
         */
        getUserById: function(usserId) {
            var returnObject;
            $.ajax({
                "type": 'GET',
                "url": CRM.getOuterUrl('/member/getUserbyUserId.do?userId=' + usserId),
                "dataType": "json",
                async: false, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode == 0 && req.status) {
                        if (req.entry) {
                            $("#userMobile").val(req.entry.mobile);
                            returnObject = req.entry;
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("根据用户ID获取用户信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
            return returnObject;
        },
        /**
         * 获得商品维护界面
         */
        getItemUrl: function(shopId) {
            return CRM.getOuterUrl('/itemcenter/crm/item/list?itemStatus=0,10,20,30,40,100&shopId=' + shopId);
        },
        /**
         * 城市下拉初始化
         */
        initCities: function() {
            $.ajax({
                url: CRM.getOuterUrl('/shop/city/queryOpenCity'),
                contentType: "application/json",
                dataType: "json", //返回格式为json
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                data: JSON.stringify({}), //参数值
                type: "POST", //请求方式
                xhrFields: {
                    withCredentials: true
                },
                success: function(req) {
                    //请求成功时处理登录
                    if (req.status == false && req.responseCode == 10212) {
                        var loc = location.href;
                        location.href = CRM.getOuterUrl('/member/login.html?redirectUrl=' + encodeURIComponent(loc));
                    } else if (req.responseCode && req.status) {
                        if (req.entry) {
                            $("#modify_city").html("");
                            for (var length in req.entry) {
                                $("#modify_city").append("<option value='" + req.entry[length].city + "'>" + req.entry[length].city + "</option>");
                            }
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询城市信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 初始化下拉清单的数据
         */
        initDatas: function() {
            this.initShopType();
            this.initShopTages();
            this.initCities();
        },
        /**
         * 查看店铺信息
         */
        modifyShop: function(shopId) {
            var self = this;
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/shop/queryShopById'),
                "dataType": "json",
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({
                    "id": shopId,
                    "operator": $.cookie('_uk')
                }),
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode && req.status) {
                        if (req.entry) {
                            self.setShopValues(req.entry);
                            $('#shop_info_dialog').modal('show');
                            $('#shop_info_dialog').on('shown.bs.modal', function(e) {});
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询店铺信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 设置查询出来的值
         * @param data
         */
        setShopValues: function(data) {
            var self = this;
            $(':input', '#modify_form')
                .not(':button, :submit, :reset')
                .val('')
                .removeAttr('checked')
                .removeAttr('selected'); //清空form
            $("[id^=img]").attr("src", "");
            $("#modify_shopId").val(data.id);
            $("#modify_shopName").val(data.shopName);
            $("#modify_shopType").val(data.type);
            $("#modify_isBalance").val(data.isBalance);
            $("#modify_tags").val(data.tags);
            self._tags = $("#modify_tags").find("option:selected").text();
            if (data.tagsDesc != "超市" && data.tagsDesc != "烟酒") { //超市和烟酒需要烟酒许可
                $("#fieldset_yc").hide();
                $("#fieldset_jl").hide();
            } else {
                $("#fieldset_yc").show();
                $("#fieldset_jl").show();
            }
            $("#modify_dayStartTime").val(data.dayStartTime);
            $("#modify_dayStartTime_view").val(data.dayStartTime);
            $("#modify_dayEndTime_view").val(data.dayEndTime);
            $("#modify_dayEndTime").val(data.dayEndTime);
            $("#modify_createXiaoer").val(data.createXiaoerName + " " + data.createXiaoerMobile);
            $("#modify_xiaoer").val(data.xiaoerName + " " + data.xiaoerMobile);
            $("#modify_xiaoerId").val(data.xiaoerId);
            $("#modify_city").val(data.city);
            $("#modify_address").val(data.address);
            $("#modify_deliveryAreaRadius").val(data.deliveryAreaRadius);
            $("#modify_leastSendAmount").val(data.leastSendAmount / 100);
            $("#modify_onlinePayOnly").val(data.onlinePayOnly);
            $("#modify_ownername").val(data.ownerName);
            $("#modify_userId").val(data.userId);
            $("#modify_ownerSocialId").val(data.ownerSocialId);
            $("#modify_socialImage").attr("src", getUrlImg() + data.socialImage);
            $("#modify_socialImageBack").attr("src", getUrlImg() + data.socialImageBack);
            $("#modify_shopWeight").val(data.shopWeight);
            $("#modify_shopFranchiseDesc").val(data.shopFranchiseDesc);
            $("#modify_updateShopFranchiseDesc").val(data.updateShopFranchiseDesc);
            var userInfo = self.getUserById($.cookie('_uk'));
            $("#card_field").hide();
            $("#zhifubao_field").hide();
            $("#modify_xiaoer").attr("readonly", "readonly");
            $("#modify_ownername").attr("readonly", "readonly");
            $("#modify_shopWeight").attr("readonly", "readonly");
            if (parseInt(userInfo.level) >= 700) {
                /*$("#modify_xiaoer").removeAttr("readonly");
                $("#modify_ownername").removeAttr("readonly");
                $("#modify_shopWeight").removeAttr("readonly");*/
                self.queryShopReceiptsAccount(data.id, 1);
                $("#card_field").show();
                $("#zhifubao_field").show();

            }
            self.queryShopBusiLicence(data.id);
        },
        /**
         * 店铺类型数据初始化
         */
        initShopType: function() {
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/shopUtil/queryShopType'),
                "dataType": "json",
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({}),
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode && req.status) {
                        if (req.entry) {
                            $("#modify_shopType").html("");
                            for (var length in req.entry) {
                                $("#modify_shopType").append("<option value='" + length + "'>" + req.entry[length] + "</option>");
                            }

                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询店铺类型信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 经营范围数据初始化
         */
        initShopTages: function() {
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/shopUtil/queryShopTags'),
                "dataType": "json",
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({}),
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode && req.status) {
                        if (req.entry) {
                            $("#modify_tags").html("");
                            for (var length in req.entry) {
                                $("#modify_tags").append("<option value='" + length + "'>" + req.entry[length] + "</option>");
                            }
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询经营范围信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 初始化日期控件
         */
        initDatetimepicker: function() {
            $(".form_time").datetimepicker({
                language: 'zh-CN',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 1,
                minView: 0,
                maxView: 1,
                forceParse: 0
            });
            $('.form_date').datetimepicker({
                language: 'zh-CN',
                weekStart: 1,
                todayBtn: 1,
                autoclose: 1,
                todayHighlight: 1,
                startView: 2,
                minView: 2,
                forceParse: 0
            });
        },
        /**
         * 小二信息查询
         */
        bindXiaoerInfo: function() {
            $('#modify_xiaoer').typeahead({
                onSelect: function(item) {
                    $("#modify_xiaoerId").val(item.value);
                },
                ajax: {
                    url: CRM.getOuterUrl("/dataapi/user/search.do?minlevel=300&start=0&count=100"),
                    displayField: "dis",
                    valueField: "valId",
                    triggerLength: 1,
                    items: 100,
                    method: "get",
                    loadingClass: "loading-circle",
                    preDispatch: function(query) {
                        return {
                            mobile: query,
                            name: query
                        }
                    },
                    preProcess: function(data) {
                        if (data.success === false) {
                            return false;
                        }
                        var docs = data.docs;
                        if (!docs || docs.length == 0) {
                            return false;
                        }
                        for (var j in docs) {
                            var doc = docs[j];
                            doc.dis = doc.mobile + ' ' + doc.realName;
                            doc.valId = doc.userId;
                        }
                        return docs;
                    }
                }
            });
        },
        /**
         * 查询店铺营业执照
         */
        queryShopBusiLicence: function(shopId) {
            var self = this;
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/licence/queryShopBusiLicence'),
                "dataType": "json",
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({
                    "shopId": shopId,
                    "operator": $.cookie('_uk')
                }),
                contentType: "application/json",
                "success": function(req) {
                    if (req.responseCode && req.status) {
                        if (req.entry) {
                            self.setShopBusiLicenceValues(req.entry);
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询店铺营业执照,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        /**
         * 设置执照的值
         * @param data
         */
        setShopBusiLicenceValues: function(data) {
            for (var length in data) {
                var _objectId = "";
                if (data[length].type == "1") { //工商营业执照
                    _objectId = "";
                } else if (data[length].type == "2") { //食品流通许可证
                    _objectId = "_sp";
                } else if (data[length].type == "3") { //卫生许可证
                    _objectId = "_ws";
                } else if (data[length].type == "4") { //烟草许可证
                    _objectId = "_yc";
                } else if (data[length].type == "5") { //酒类许可证
                    _objectId = "_jl";
                }
                $("#modify_legalPerson" + _objectId).val((data[length].legalPerson));
                $("#modify_busiLicenceNo" + _objectId).val((data[length].busiLicenceNo));
                $("#modify_expDate" + _objectId + "_view").val(data[length].expDate);
                $("#modify_expDate" + _objectId).val(data[length].expDate);
                $("#modify_id" + _objectId).val(data[length].id);
                $("#img" + _objectId).attr("src", getUrlImg() + data[length].busiLicencePic);

            }
        },
        /**
         * 审核通过
         * @param shopId
         */
        auditShopSuccess: function(shopId) {
            $('#shop_info_dialog').modal('hide');
            $('#comfirm').unbind("click");
            $("#comfirm").on('click', function() {
                $('#confirm_dialog').modal('hide');
                $.ajax({
                    "type": 'POST',
                    "url": CRM.getOuterUrl('/shop/shop/auditShopFinance'),
                    "dataType": "json",
                    async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                    contentType: "application/json",
                    xhrFields: {
                        withCredentials: true
                    },
                    "data": JSON.stringify({
                        id: $("#modify_shopId").val()
                    }),
                    contentType: "application/json",
                    "success": function(req) {
                        console.log(req);
                        CRM.showDialog(req.message);
                        $('#shop_table').DataTable().ajax.reload();
                    },
                    error: function(e) {
                        //请求出错处理
                        CRM.showDialog("审核通过,请求服务异常！");
                    }
                });
            });
            $("#confirm_dialog_content").text("确定通过该审核？");
            $('#confirm_dialog').modal('show');
        },
        /**
         * 审核不通过
         * @param shopId
         */
        auditShopFail: function(shopId) {
            $('#shop_info_dialog').modal('hide');
            $('#comfirm_width_input').unbind("click");
            $("#comfirm_width_input").on('click', function() {
                if ($('#confirm_dialog_with_input_input').val()) {
                    $('#confirm_dialog_with_input').modal('hide');
                    $.ajax({
                        "type": 'POST',
                        "url": CRM.getOuterUrl('/shop/shop/auditShopFail'),
                        "dataType": "json",
                        async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                        contentType: "application/json",
                        xhrFields: {
                            withCredentials: true
                        },
                        "data": JSON.stringify({
                            id: $("#modify_shopId").val(),
                            audtiFailMsg:$('#confirm_dialog_with_input_input').val(),
                            operator: $.cookie('_uk')
                        }),
                        contentType: "application/json",
                        "success": function(req) {
                            $("#msg_dialog_content").text(req.message);
                            $('#msg_dialog').modal('show');
                            $('#shop_table').DataTable().ajax.reload();
                        },
                        error: function(e) {
                            //请求出错处理
                            $("#msg_dialog_content").text("审核不通过,请求服务异常！");
                            $('#msg_dialog').modal('show');
                        }
                    });
                }else{
                    $('#confirm_dialog_with_input_alert').html("必须填写复审失败原因！");
                }
            });
            $("#confirm_dialog_with_input_content").text("确定不通过该审核？");
            $('#confirm_dialog_with_input').modal('show');
        },
        /**
         * 查询店铺收款账户信息
         * @param shopId
         * @param receiptAccountType
         */
        queryShopReceiptsAccount: function(shopId, receiptAccountType) {
            var self = this;
            $.ajax({
                "type": 'POST',
                "url": CRM.getOuterUrl('/shop/account/queryShopReceiptsAccount'),
                "dataType": "json",
                async: true, //请求是否异步，默认为异步，这也是ajax重要特性
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                "data": JSON.stringify({
                    shopId: shopId,
                    receiptAccountType: receiptAccountType,
                    operator: $.cookie('_uk')
                }),
                contentType: "application/json",
                "success": function(req) {
                    if (req.status) {
                        if (req.entry) {
                            if (receiptAccountType == 1) {
                                $("#cardPic").attr("src", getUrlImg() + req.entry.cardPic);
                                $("#modify_cardName").val(req.entry.accountName);
                                $("#modify_cardNum").val(req.entry.accountNO);
                                self.queryShopReceiptsAccount(shopId, 2);
                            } else {
                                $("#zhifubao_cardName").val(req.entry.accountName);
                                $("#zhifubao_cardNum").val(req.entry.accountNO);
                            }
                        }
                    } else {
                        $("#msg_dialog_content").text(req.message);
                        $('#msg_dialog').modal('show');
                    }
                },
                error: function(e) {
                    //请求出错处理
                    $("#msg_dialog_content").text("查询店铺收款账户信息,请求服务异常！");
                    $('#msg_dialog').modal('show');
                }
            });
        },
        bindEvent: function() {
            var self = this;
            $("#search_btn").on('click', function() {
                self.doSearch();
            });
            $("#pass").on('click', function() {
                self.auditShopSuccess();
            });
            $("#not_pass").on('click', function() {
                self.auditShopFail();
            });
        }
    };

    /**
     * 图片上传的
     * @returns {*}
     */
    function getUrlImg() {
        // 日常环境
        if (!!~location.host.indexOf('daily.')) {
            //return 'http://imgdaily.52shangou.com/img/';
            return 'http://imgsize.52shangou.com/img/'
        }
        // 线上环境 & 灰度环境
        else {
            return 'http://imgsize.52shangou.com/img/'
        }
    }

    window.changeShopOwner = Config.changeShopOwner;
    window.doSearch = $.proxy(Config.doSearch, Config);
    window.editShop = $.proxy(Config.editShop, Config);
    window.deleteShop = $.proxy(Config.deleteShop, Config);
    window.modifyShop = $.proxy(Config.modifyShop, Config);
    window.auditShop = $.proxy(Config.auditShop, Config);
    window.shopSuspension = $.proxy(Config.shopSuspension, Config);
    window.shopCouponSwitch = $.proxy(Config.shopCouponSwitch, Config);
    window.shopPauseOrOnSale = $.proxy(Config.shopPauseOrOnSale, Config);
    window.modifyShopSale = $.proxy(Config.modifyShopSale, Config);


    Config.init();
});
